package com.th.basemodel.http.interceptor

import android.os.Build
import android.provider.Settings
import com.th.basemodel.utils.AppUtil
import com.th.basemodel.utils.CommUtils
import okhttp3.Interceptor
import okhttp3.Response
import okio.IOException

class CustomQueryInterceptor : Interceptor {
    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        var request = chain.request()

        val httpUrl = request.url.newBuilder()
            .addQueryParameter("RnqcoCVToadeaterTRdhDOo", "android")
            .addQueryParameter("UBbFTkISpasmicSVzlMwh", AppUtil.getVersionName())
            .addQueryParameter("OvzyBEVUncleannessSpwdJyB", Build.MODEL)
            .addQueryParameter("ERTHvSLNowaysYTCweiv", Settings.Secure.getString(CommUtils.getContext().getContentResolver(), Settings.Secure.ANDROID_ID))
            .addQueryParameter("WJkzerdPalatablyEDruioY", Build.VERSION.RELEASE)
            .addQueryParameter("qRRRvKwDragonesqueJcXmmuC", "th")
            .addQueryParameter("tXkcBaQPayslipQlFCHUN", AppUtil.sessionId)
            .addQueryParameter("ATQbfadAllowedlyQCdkBOz", CommUtils.getContext().packageName)
            .addQueryParameter("BOmgDtGNyalaZJFsybd", AppUtil.adid)
            .addQueryParameter("esKltshCorrodyDNQBuyO", AppUtil.userPhone)
            .addQueryParameter("QrBtyVyProprietressOWxNoHy", "")
            .build()

        return chain.proceed(request.newBuilder().url(httpUrl).build())
    }
}